home *** CD-ROM | disk | FTP | other *** search
/ MIDICraft's MIDINET CD-ROM / MIDICraft's MIDINET CD-ROM.iso / CONVERTR / MIDIMOD.DOC < prev    next >
Text File  |  1993-06-28  |  22KB  |  401 lines

  1. MIDIMOD - Amiga Noise/Sound/Protracker to MIDI file converter (ver 0.2)
  2. (c)opyright Andrew Scott 1993
  3.  
  4. MIDIMOD - What it does
  5. ----------------------
  6. MIDIMOD is a program which converts music modules generated by Amiga
  7. tracker programs (MOD files) to general MIDI format 1 (MID files). It is
  8. menu-driven and if not "user-friendly", at least "user-polite". No
  9. temporary files are created at any stage, so it is ok to be run on a
  10. floppy drive (though a disk-cache utility or a fast drive are
  11. preferred.. in fact, the faster the computer the better). Some editting
  12. of the output MID file might be necessary, but next time there will be
  13. less editting to do as MIDIMOD can remember previous settings.
  14.  
  15. Why convert MOD files to MID files?
  16. -----------------------------------
  17. Even though MOD files contain some music-instructions that cannot be
  18. represented in MID format, there are many reasons why it is desirable to
  19. have music in MID form rather than MOD form:
  20.     * Some sound cards cannot play MOD files, only MID files (eg. Ad
  21.      Lib)
  22.     * Top-of-the-range music editting programs do not handle MOD files,
  23.      but almost always handle MID files, or at least allow you to
  24.      convert from MID files.
  25.     * There exist programs to print out MID files as musical score. I
  26.      don't know of any which do the same for MOD files
  27.     * MID files tend to be much smaller than MOD files
  28.     * On some sound cards, MID files sound better than MOD files
  29.      (although on many others the converse is true)
  30.     * MID files are more portable, having a well-known format, and have
  31.      utilities on many different computers. MID files _ARE_ the industry
  32.      standard.
  33.     * MID files can be played on professional keyboards, allowing expert
  34.      recording/presentation of music
  35.     * Umm.. Microsoft Windows comes with a MID player but not a MOD
  36.      player, so you can play MID files as a background task (and insert
  37.      MID files into documents etc. etc.)
  38. Ok.. have I sold you on MOD->MID conversion yet?
  39.  
  40. How to use MIDIMOD
  41. ------------------
  42. After starting up MIDIMOD (I assume you know how to do that), you can
  43. select menus and commands by simply pressing a key. There are 3 menus:
  44.     * File menu (press "F"): commands to do with files
  45.     * Samples menu (press "S"): commands to do with samples
  46.     * Options menu (press "O"): commands to set simple configurations
  47.     * Help menu (press "H"): commands to do with help
  48. You can also use the cursor keys to select menus and commands, and then
  49. press <RETURN> to select that command.
  50.  
  51. The File Menu
  52. -------------
  53. The file menu consists of 4 commands:
  54.     * Destination MIDI file (press "D"): A dialogue box will appear and
  55.      ask you to enter the name of a MID file. After entering the full
  56.      name (including extension eg. TECHNO.MID) press <RETURN>. If the
  57.      file you entered already exists then you will be asked if it can be
  58.      overwritten.. press "Y" for yes or "N" for no.
  59.     * Source MOD file (press "S"): A dialogue box will appear similar to
  60.      the "Destination MIDI" one. Enter a filename then press <RETURN>.
  61.     * Convert (press "C"): This will convert the MOD file you entered to
  62.      the MID file you entered. I suggest before you do this step, use
  63.      the Sample menu to set samples to appropriate instruments.
  64.      Sometimes conversion takes a while - please be patient. If you get
  65.      an error message which says that you have too many different
  66.      instruments, then use the "Map samples" command to reduce the
  67.      number.
  68.     * Quit (press "Q"): Yep.. you quit MIDIMOD if you choose this
  69.      command.
  70.  
  71. The Samples Menu
  72. ---------------
  73. The samples menu consists of 2 commands:
  74.     * Map samples (press "M"): There are many, many MOD samples on
  75.      computers around the world, so it is impossible to automatically
  76.      know which instrument is equivalent to which sample. You must tell
  77.      MIDIMOD which instrument to use. Use the cursor keys and <RETURN>
  78.      to select a sample from the list that appears on the screen. It is
  79.      possible that the list will be longer than the screen and so you
  80.      will need to move off the bottom of the list (don't worry.. the
  81.      list will scroll upwards if it can). If you can't move off the
  82.      top/bottom of the list, you will hear a beep. Each sample may have
  83.      an asterisk "*" before it - this means that there is actual sample
  84.      data that corresponds to this sample - ignore any other samples..
  85.      they won't be converted (except in name only). Each sample will
  86.      have an instrument code to its right. If the code is prefixed by a
  87.      "D" then it is a percussion code. Anyway.. after selecting a
  88.      sample, a list of all of the available instruments will appear on
  89.      the screen (it is another scrolling menu). Select one and the
  90.      appropriate code will appear to the right of the chosen sample. If
  91.      you don't want to select anything from a menu, just press <ESCAPE>.
  92.      So when all samples have been given instruments (sometimes they
  93.      will already have an instrument code.. it is best to leave these
  94.      codes as they already have been matched with a sample's name) press
  95.      <ESCAPE>
  96.     * Transposing (press "T"): Even if you have matched a MOD sample
  97.      with a MIDI instrument there is no guarantee that each will play at
  98.      the same pitch. MOD samples tend to sound high, low, very low, or
  99.      slightly off pitch when both MOD and MIDI instruments play the same
  100.      note. The trick is to map MOD samples to a different note during
  101.      the conversion, so that there won't be any horrible musical
  102.      clashes. A good way to do this is to find a sample that maps
  103.      exactly to a MIDI instrument, and then get a MOD-editor and play
  104.      other samples, and compare those samples to the "true" sample. This
  105.      way you can find the number of semitones difference there are
  106.      between a MOD sample and its instrument equivalent. For example,
  107.      bass guitar samples are usually an octave lower (sometimes two)
  108.      than their actual note. As an octave is 12 semitones, if the guitar
  109.      sample is transposed down 12 semitones, it sounds ok. Another
  110.      example, chords are usually made up of 3 notes which are played
  111.      simulateously (major chords have part of them transposed up 4
  112.      semitones, and another part 7 semitones where minor chords have 3
  113.      and 7 semitone transposed parts). After selecting a MOD-sample from
  114.      the menu (the numbers on the right are the transpose values), you
  115.      can enter in its transposition. For a bass sample you might enter:
  116.           -12
  117.      then press <RETURN>, whereas for a major chord you might enter
  118.           0, 4, 7
  119.      then press <RETURN>, and for a bass major chord you might enter
  120.           -12, -8, -5
  121.      then press <RETURN> (note than -12+4=-8 etc.). During conversion,
  122.      these transpositions are applied and hopefully the MID-file won't
  123.      sound as if many musicians are playing using different scales. A
  124.      couple of things you need to watch out for: if one of the
  125.      transposition values is 0 then it must be the first value, also
  126.      don't transpose percussion instruments - it's not a good idea.
  127.     * Volume shift (press "V"): This is similar to transposing, but it
  128.      affects volume rather than pitch. MIDIMOD alters volumes by
  129.      applying a formula to each volume in the MOD file. The formula is
  130.      simple: it takes the volume, then adds a number, then multiplies by
  131.      a number, then divides by a number. So all you have to do is supply
  132.      3 numbers, though when you come to change a volume formula you will
  133.      notice that MIDIMOD has already given each sample a formula.
  134.      MIDIMOD analyses each sample of the MOD file when you it reads in
  135.      the MOD file and based on this analysis allocates a formula to the
  136.      samples. Note that these formulae are not necessarily correct, they
  137.      are just MIDIMOD's best guess, but most of the time they will
  138.      suffice. To set the formula yourself, choose a sample then enter
  139.      the three numbers for the formula respectively (as you do for
  140.      transposition amounts), eg. if you want to "add 1, multiply by 2,
  141.      then divide by 3" every volume for a particular sample, you would
  142.      enter:
  143.           1, 2, 3
  144.      the press <RETURN>. The last two numbers cannot be negative, and
  145.      last number cannot be 0.
  146.     * Save info (press "S"): Because it is nicer to have the computer
  147.      select instruments, transpositions and volume shifts for you than
  148.      having to look them up each time, MIDIMOD keeps a list of "known"
  149.      mappings/transposes/volume-shifts from MOD-samples to MID-
  150.      instruments. Once you have selected a mapping using the "Map
  151.      samples", a transposition using "Transposing", or a volume shift
  152.      using "Volume shift" you can use this command to save a sample's
  153.      info to the info file. Just select the sample with the cursor keys
  154.      and <RETURN> and it is done. Press <ESCAPE> to leave this command.
  155.  
  156. The Options Menu
  157. ----------------
  158. There are 2 commands which allow you to set options:
  159.     * Drum channel (press "D"): As different software/soundcard/hardware
  160.      is by definition different, I decided that setting the drum channel
  161.      to 10 permanently (as I did in version 0.1) is a bit impolite. So
  162.      you can choose this option and enter the drum channel that you want
  163.      (though if you don't enter any drum channel, it will assume you
  164.      meant channel 10).
  165.     * Tempo type (press "T"): Hmmm.. the MOD format caught me out with
  166.      this one in version 0.1, and I didn't know what to do to fix it, so
  167.      hence this option. Some MOD-files use an old tempo convention and
  168.      the rest use a newer one. Some MOD-files don't convert at all well
  169.      if the wrong convention is used. Anyway, after selecting this
  170.      option press either "0" or "1" to select new or old conventions
  171.      respectively. Initially, the convention will be the old one. If
  172.      the MID file produced sounds like the timing is out of whack, try
  173.      changing the tempo type and then doing the conversion again.
  174.  
  175. The Help Menu
  176. -------------
  177. There is only 1 command in the help menu:
  178.     * About (press "A"): This displays some information about MIDIMOD.
  179.      Press any key to make it go away.
  180. If you really wanted help.. print out this document and use it as a
  181. reference while you use MIDIMOD. If you are still stuck, call up a
  182. friend who knows a bit about computers and ask them what to do (but you
  183. were going to do that anyway weren't you?).. it may help if they know
  184. something about music too. Maybe get in contact with a hacker-friend and
  185. a muso-friend. On the other hand, maybe it would be best to throw a
  186. party and invite all your friends around.
  187.  
  188. Command Line Parameters
  189. -----------------------
  190. When executing MIDIMOD, you can put the two filenames on the command-
  191. line, eg.
  192.           midimod headbang.mod techno.mid
  193. The first filename (you guessed it) is the MOD file, and the second is
  194. the MID file. If the MID-file already exists, then you will be asked if
  195. you really want to overwrite it.
  196.  
  197. Example Session
  198. ---------------
  199. Ok.. just incase everything I have said so far has gone over your head,
  200. here is the way that I use the program (and it works for me.. honest!):
  201.     * Run MIDIMOD by typing "MIDIMOD" at the command-line and press
  202.      <RETURN>
  203.     * Press "F" followed by "S" to choose the "Source MOD file" command.
  204.     * Enter the MOD file name (eg. headbang.mod) and press <RETURN>.
  205.     * Press "D" to choose the "Destination MIDI file" command.
  206.     * Enter the MID file name (eg. techno.mid) and press <RETURN>
  207.     * Press either: the right cursor key
  208.                 or: <ESCAPE> followed by "S"
  209.     * Press "M" to choose the "Map Samples" command.
  210. <<1>>
  211.     * Now use the up cursor key and the down cursor key to highlight a
  212.      sample, then press <RETURN> to select it. Remember, only the
  213.      samples with a "*" on the left-hand side are actually samples, the
  214.      rest are probably just advertising.
  215.     * Now use the up cursor key and the down cursor key to highlight an
  216.      instrument (you should be getting quite good at this now) then
  217.      press <RETURN> to select it. If the sample was percussion, you
  218.      should've selected a percussion instrument (the ones with a "D" on
  219.      the left).
  220.     * Go back to <<1>> and do these steps until you get sick of them, or
  221.      all of the proper samples have been allocated an instrument
  222.     * Press <ESCAPE> to quit from this command
  223.     * Press either: the left cursor key, or
  224.                     <ESCAPE> followed by "F"
  225.     * Press "C" to choose the "Convert" command.
  226.     * Wait for the disk to stop writing, and the cursor to reappear.
  227.     * Press "Q" to choose the "Quit" command.
  228. There should now be a file lying around called "techno.mid" or whatever
  229. you typed in. This is the MIDI equivalent of the MOD file.
  230.  
  231. The Instruments
  232. ---------------
  233. The list of MIDI instruments is kept in the text file "midimod.ins".
  234. Each instrument on a separate line. The first 128 lines must hold the
  235. instruments 0 to 127. The lines after this hold the percussion
  236. instruments (no more than 128). All instruments should have a code as
  237. the first thing on the line. The code must consist of the letter "D"
  238. (only if it is a percussion instrument) followed by a number from 0 to
  239. 127. This file can be editted with a text editor to put in the
  240. instruments for your particular soundcard/computer/keyboard/software
  241. etc. The supplied instrument file contains the Soundblaster MIDI
  242. patches, if you are using a synth or a different sound card, then edit
  243. this file and insert the correct instruments for you.
  244.  
  245. The Info File
  246. -------------
  247. A list of default mappings and transpositions is kept in the text file
  248. "midimod.map". This is maintained with the "Save info" command in the
  249. "Samples" menu, but it can also be editted with a text-editor. Each
  250. sample is on a separate line, and consists of the first word in the
  251. sample's name followed by 7 numbers, all separated by spaces. The first
  252. word is the sample's name (which comes right after any header (st-xx: or
  253. leading spaces) and has any intermediate spaces replaced by underbar
  254. characters. The first number is a mapping number, the next three numbers
  255. are transposition values (normally 0 0 0), and the last three are the
  256. volume-shift values (eg. 1 0 0). The mapping numbers range from 0 to
  257. 255. The numbers 0-127 correspond to the MIDI instruments 0-127, and the
  258. other mapping numbers are the percussion instrument codes plus 128
  259. (without the "D" infront of course). The transposition values hold
  260. either a set amount to transpose the instrument by (first transposition
  261. value) or a mapping to a chord (two or more non-zero numbers). Any 0
  262. transposition value must occur in the first position. The transposition
  263. values range -128 to 127, 0 to 127, and 1 to 127 respectively in the
  264. formula (volume + x) * y / z. Each line in the info file is in
  265. alphabetical order, and it would be a bad idea to put a sample in the
  266. wrong place.
  267.  
  268. All of the mapping/transpositions in the supplied "midimod.map" file are
  269. for the soundblaster card (preferrably running windows). If none of the
  270. info applies to you, you can delete the file and replacing it with the
  271. "blank.map" file provided. It is probably better to note down some of
  272. the info in the given "midimod.map", as even if mappings are wrong,
  273. transpose and volume-shift values will still apply.
  274.  
  275. What is this .mm file?
  276. ----------------------
  277. Because there are some times when you don't want to store information
  278. about a MOD file in the info file, a file with the same name as the MOD-
  279. file except with a .mm extension is created. This .mm file holds all of
  280. the information that you have entered about the MOD-file. It is
  281. automatically read in when you load the MOD file, and automatically
  282. saved when you quit. It is read in just before checking the info file
  283. (above), and so if you have added any new sample info that applies to
  284. that particular MOD-file it will be included. You can safely delete
  285. the .mm file, but it will come back next time you using that MOD-file. 
  286.  
  287. Notes on Conversion
  288. -------------------
  289. Firstly, the way the algorithm works, each different instrument is
  290. allocated a different channel (this makes later editting of the MID file
  291. _MUCH_ easier). As there are only 16 different channels this causes a
  292. bit of a problem when you have a MOD file with 31 different samples. All
  293. is not lost due to the nature of MOD files. Each percussion instrument
  294. can be put on the same channel (10), giving you unlimited percussion
  295. instruments but 15 channels for the other instruments. If the MOD file
  296. you are using has more than 15 completely different non-percussion
  297. samples then it is an unusual MOD file indeed, and you will need to give
  298. some of the non-percussion samples the same instrument.
  299.  
  300. There is also some ambiguity with regard to multiple notes of the same
  301. pitch on the same channel in the MIDI format. The MOD format can handle
  302. it if the notes are on different channels, but if they are the same
  303. sample then MIDIMOD will map them to the same channel in MIDI format.
  304. Some MIDI players allow "overlapping" notes, some don't - I was going to
  305. automatically remove "overlapped" notes, but no MIDI-player that I have
  306. look at chucks a fit if they are in, so they are still there. Cross your
  307. fingers and everything should sound fine.
  308.  
  309. It seems that there is also ambiguity with the MOD format, and tempo can
  310. be interpretted two ways (I hope there aren't any more!). If your MID
  311. file sounds like it should be in a different tempo in places, try
  312. changing the "Tempo Type" Option (from the Options menu.. see above).
  313.  
  314. Even with automatic volume-shift allocation and checking of the info-
  315. file for previous samples you will occasionally meet a converted MID
  316. file that doesn't sound right (well.. with all of the different hardware
  317. and software around, what can you expect?). Also, some samples may not
  318. be recognised by MIDIMOD and may need transposing otherwise the tune
  319. might sound horrible.. but as soon as you find correct details about any
  320. new sample, feed them back into MIDIMOD so it can recognise them
  321. correctly next time.
  322.  
  323. Not all MOD effects can be reproduced in a MID file. Things that I have
  324. been able to reproduce include:
  325.     * Tempo (given that your MID player can handle a tempo-track)
  326.     * Note length (calculated from frequency, tempo, and # bytes in sample)
  327.     * Pattern Break
  328.     * Position Jump (well.. not really.. pretend its Pattern Break)
  329.     * Set Volume
  330.     * Note slides (slide up, slide down, slide to, fine-up, fine-down)
  331.      all implemented, but permanently in glissando mode (ie. not a
  332.      smooth slide).
  333.     * Arpeggio
  334.     * Volume Slides (and finevolume slides), but only if they occur at
  335.      the start of a note
  336.     * Set Sample Offset (actually retriggers the sample)
  337.     * Retrigger sample
  338.     * Cut sample
  339.     * Delay sample
  340.     * Pattern delay
  341. Effects that I have not been able to reproduce, or have ignored on the
  342. grounds that they are silly in a MID file are:
  343.     * Vibrato and Tremolo (not really possible to do nicely in a MID file)
  344.     * Position Jump (I have sort-of included it)
  345.     * Pattern Loop (dangerous.. can cause infinite loops.. MIDI doesn't
  346.      support loops so left it out)
  347.     * Set filter (an Amiga-only hardware effect)
  348.     * Set glissando (permanently on)
  349.     * Set vibrato/tremolo waveforms (no MIDI equivalent)
  350.     * Invert loop (*sigh* MIDI can't even come close to implementing
  351.      this one)
  352. Hmm.. looking back at what I have included, it seems that MIDIMOD has
  353. more features than some MOD-file players I have seen! (Some MOD-file
  354. players are really bad.. but this might be because not many programmers
  355. know the MOD-format specification.)
  356.  
  357. Source Code
  358. -----------
  359. I am distributing the source code - in fact, so must you! If MIDIMOD is
  360. placed on a publicly accessible medium (eg. BBS, FTP-site, Shareware
  361. vendor, etc.), then the source code must be there too. It must always be
  362. possible for the user to be able to modify this program. This allows
  363. multiple-platform distribution, allows everyone to add their little
  364. tweaks or use their favourite optimiser, and is even educational (if you
  365. can stand my code). It is legal to only possess the executable-code, but
  366. not to distribute only the executable. It is legal to distribute only
  367. the source code. For more information on the license, see the textfile
  368. also distributed with this package. Oh.. by the way.. if your computer
  369. crashes when running this program and you lose 3 years of hard work and
  370. gain a stomach ulser, don't blame me.. blame the power station, or the
  371. computer store, or your nextdoor neighbor. Details of who not to blame
  372. are also in the license.
  373.  
  374. The source code consists of three .c files and and two header files:
  375.     * midimod.c - main program
  376.     * midimod.h - header file for midimod.c
  377.     * textwin.c - text-windowing system I notched up because I didn't
  378.      have one, and because I wanted one for midimod. Hence it's rather
  379.      incomplete.
  380.     * textwinc.c - same text-windowing system as textwin.c, but runs
  381.      with the "curses" system. As curses is rather machine-independent,
  382.      this allows MIDIMOD to be recompiled for just about any computer.
  383.     * textwin.h - header file for textwin.c
  384. If you are creating an executable, make sure you link textwin with
  385. midimod. MIDIMOD was compiled on Turbo C 2.0, though it should work on
  386. any ANSI C compiler (if it's not an MSDOS gizmo, use textwinc.c instead
  387. of textwin.c)
  388.  
  389. How to get in touch
  390. -------------------
  391. You can email me on the Internet at:
  392.   ascott@tartarus.uwa.edu.au
  393. I did have a FIDO-net address.. but I have forgotten it.. oh well.
  394. Snail-mail me at:
  395.   Andrew Scott
  396.   55 McCabe Street
  397.   Mosman Park
  398.   Western Australia,  6012
  399. Be warned.. I only speak English. Well.. I speak other languages as
  400. well.. but not very good! (a joke.. a joke)
  401.